#ifndef BRUTE4QT_H
#define BRUTE4QT_H
#include <QtGui>
#include "ui_brute4qt.h"
#include <QWebView>
#include <QDomDocument>

namespace Ui
{
    class Brute4Qt;
}

class Brute4Qt : public QMainWindow
{
    Q_OBJECT
public:
    Brute4Qt(QWidget *parent = 0);
    ~Brute4Qt();

private:
    Ui::Brute4Qt *ui;
    QLabel* statusLabel1;
    QLabel* statusLabel2;
    QProcess *process1;
    QProcess *process2;
    void evaluate(const QString &filename,const QString &query);
    void exportToHtml(const QString &xmlInputFile, const QString &xmlOutput);
    void addProjects();
    void addOutputs();
    QString getBenchmark(const QString &benchmQuery,const QString &xmlInputFile);
    void addOutput(const QString &str);
    void addProject(const QString &path);
    QDomElement addNode( QDomDocument &d, const QString &c, const QString &attribute = "" );

    static QString mainQuery;
    static QString benchmarkQuery;
    static QString mainTable;
    static QString benchmarkTable;

public slots:
    void runningProcess1();
    void stoppedProcess1();
    void runningProcess2();
    void stoppedProcess2();
    void outputProcess1();
    void outputProcess2();
    void processXml1();
    void processXml2();

    void runProgram(QString &prog,QStringList args,QString &path,bool output = false,bool xml = false);

    void on_tabWidget_currentChanged(int index);
    void on_listWidget_currentRowChanged(int currentRow);
    void on_exportBtn_clicked();
    void on_refreshBtn_clicked();
    void on_runBtn_clicked();
    void on_openBtn_clicked();
    void on_browserBtn_clicked();
    void on_compileBtn_clicked();
    void updateTabs();

    void readFolderXML(QTreeWidgetItem* item, const QString &filename);
    void createTestXML(const QString &path,const QString &profile);
};

#endif // BRUTE4QT_H
